package com.robot.agent.client;

import com.robot.agent.client.impl.MemberClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * member模块跨域调用
 *
 * @author wuyunbin
 */
@Component
@FeignClient(value = "robot-member", fallback = MemberClientImpl.class)
public interface MemberClient {
    /**
     * 通过id查询会员
     *
     * @param id
     * @return
     */
    @GetMapping(value = "member/third/findMemberById/{id}", produces = "application/json; charset=utf-8")
    public String thirdFindMemberById(@PathVariable String id);


    /**
     * 城市经理查看商户入驻申请
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "merchant_apply/third/findMerchantAppliesBySearch/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindMerchantAppliesBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 通过areaId查询merchant_apply列表
     *
     * @param areaId
     * @return
     */
    @PostMapping(value = "merchant_apply/third/findMerchantAppliesByAreaId/{areaId}", produces = "application/json; charset=utf-8")
    public String thirdFindMerchantAppliesByAreaId(@PathVariable String areaId);

    /**
     * 通过areaId和status查询merchant_apply列表
     *
     * @param areaId
     * @param status
     * @return
     */
    @PostMapping(value = "merchant_apply/third/findMerchantAppliesByAreaIdAndStatus/{areaId}/{status}", produces = "application/json; charset=utf-8")
    public String thirdFindMerchantAppliesByAreaIdAndStatus(@PathVariable String areaId, @PathVariable String status);

    /**
     * 通过id查询merchant_apply详情
     *
     * @param id
     * @return
     */
    @GetMapping(value = "merchant_apply/third/findMerchantApplyById/{id}", produces = "application/json; charset=utf-8")
    public String thirdFindMerchantApplyById(@PathVariable String id);

    /**
     * 修改merchant_apply详情
     *
     * @param apply
     * @return
     */
    @RequestMapping(value = "merchant_apply/third/updateMerchantApply", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    @Transactional(rollbackFor = Exception.class)
    public boolean thirdUpdateMerchantApply(@RequestBody String apply);
}
